﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title> - 数据表格</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="${pageContext.request.contextPath }/shoppingadmin/favicon.ico">
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/dataTables.bootstrap.css" rel="stylesheet">

    <link href="${pageContext.request.contextPath }/shoppingadmin/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="${pageContext.request.contextPath }/shoppingadmin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>用户管理</h5>
                        <div class="ibox-tools">
                        	<!-- <a href="admin_user_edit.action">
                        		 <button type="button" class="btn btn-default btn-xs">添加</button>
                        	</a> -->
                        </div>
                    </div>
                    <div class="ibox-tools" style="margin-top: 0px;float: left;">
                          <form action="${pageContext.request.contextPath }/member/userlist.html" method="post" role="form" class="form-inline">
                           <input type="hidden" name="" value="">
                           <div class="form-group" style="padding-right: 5px;padding-left: 5px;">
                               <div class="col-sm-10" style="margin-bottom: 5px; margin-top:5px;padding-right: 0px;padding-left: 0px;">
                                   <input name="Idcode" placeholder="身份编号" style="height: 29px;width: 120px;" class="form-control">
                               </div>
                           </div>
                           <div class="form-group" style="padding-right: 5px;padding-left: 5px;">
                               <div class="col-sm-10" style="margin-bottom: 5px; margin-top:5px;padding-right: 0px;padding-left: 0px;">
                                   <input name="memberNames" placeholder="会员姓名" style="height: 29px;width: 120px;padding: 6px 5px;" class="form-control">
                               </div>
                           </div>
                           <div class="checkbox m-l m-r-xs" style="margin-left: 0px; margin-top:5px;">
                               <button class="btn btn-white" type="submit">查询</button>
                           </div>
                      	</form>
                        </div>
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover dataTables-example">
                           <c:if test="${error !=null }">
                           <tr>${error}</tr>
                           </c:if>
                            <thead>
                                <tr>
                                	<th>用户名</th>
                                    <th>联系电话</th>
                                    <th>地址</th>
                                    <th>身份编号</th>
                                    <th>银行编码</th>
                                    <th>累计消费</th>
                                    <th>会员状态</th>
                                    <th>推荐人</th>
                                    <th style="text-align: center;">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            	<c:forEach var="list" items="${userlist }">
                            		<tr class="gradeX">
                                    <td>${list.userName }</td>
                                    <td>${list.userPhone }</td>
                                    <td>${list.provinces.province}${list.citys.city }${ list.areas.area }</td>
                                    <td>${list.cardTypeName }</td>
                                   	<td>${list.bankId }</td>
                                    <td>${list.cumulative }</td>
                                    <td> 
                                    <c:if test="${list.memberState==0 }">
                                    	未激活
                                    </c:if>
                                    <c:if test="${list.memberState==1 }">
                                    	已激活
                                    </c:if>
                                    </td>
                                    <td>${list.referrer }</td>
                                    <td style="text-align: center;">
                                    	
                                    	<a class="btn btn-white btn-bitbucket" title="编辑" href="${pageContext.request.contextPath }/member/selByid.html?Userid=${list.userId}">
                           					<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
                        				</a>
                        				<input type="hidden" value="${list.userId }"/>
                        				<a class="btn btn-white btn-bitbucket delete" title="删除"  href="javascript:;">
                           					 <i class="fa fa-trash-o" aria-hidden="true"></i>
                        				</a>
                        			</td>
                                </tr>
                            	</c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/bootstrap.min.js?v=3.3.6"></script>

    <script src="${pageContext.request.contextPath }/shoppingadmin/js/plugins/jeditable/jquery.jeditable.js"></script>

    <!-- Data Tables -->
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/plugins/dataTables/dataTables.bootstrap.js"></script>

    <!-- 自定义js -->
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/content.js?v=1.0.0"></script>

  	<script src="${pageContext.request.contextPath }/shoppingadmin/js/plugins/sweetalert/sweetalert.min.js"></script>
    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function () {
        	 $(".delete").click(function () {
                var id=$(this).prev().val();
                
                if(confirm("确定删除吗？删除后将无法恢复！")){
                    window.location.href="${pageContext.request.contextPath }/member/deluser.html?Userid="+id;
                    return true;
                }else{
                    return false;
                }
            });
        	
            $('.dataTables-example').dataTable();

            /* Init DataTables */
            var oTable = $('#editable').dataTable();

            /* Apply the jEditable handlers to the table */
            oTable.$('td').editable('../example_ajax.php', {
                "callback": function (sValue, y) {
                    var aPos = oTable.fnGetPosition(this);
                    oTable.fnUpdate(sValue, aPos[0], aPos[1]);
                },
                "submitdata": function (value, settings) {
                    return {
                        "row_id": this.parentNode.getAttribute('id'),
                        "column": oTable.fnGetPosition(this)[2]
                    };
                },

                "width": "90%",
                "height": "100%"
            });


        });

        function fnClickAddRow() {
            $('#editable').dataTable().fnAddData([
                "Custom row",
                "New row",
                "New row",
                "New row",
                "New row"]);

        }
    </script>
</body>

</html>
